package client.comm.baoding.adapter.main

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentStatePagerAdapter
import client.comm.baoding.R
import client.comm.baoding.fragment.TabOneFragment
import client.comm.baoding.fragment.TabWhiteFragment
import client.comm.commlib.ContextProvider

class HomePageAdapter(fm: FragmentManager) : FragmentStatePagerAdapter(fm) {


    private val tabTitles: Array<String?> by lazy {  arrayOf("首页", ContextProvider.get().activity!!.getString(R.string.app_name_ziying))}

    private val fragments = arrayOf(TabOneFragment(), TabWhiteFragment())

    override fun getItem(position: Int): Fragment {
        return fragments[position]
    }

    override fun getCount(): Int {
        return fragments.size
    }

    override fun getPageTitle(position: Int): CharSequence? {
        return tabTitles[position]
    }

   /* private val fragments: Array<Fragment?> by lazy {
        arrayOfNulls(2)
    }

    override fun getItem(position: Int): Fragment {
        if (position == 0) {
            fragments[0] = TabOneFragment()
        } else {
            fragments[position] = TabWhiteFragment()
        }
        *//*else {
            fragments[position] = AuctionSubscribeOneFragment()
        }*//*
        return fragments[position]!!
    }*/

    override fun getItemPosition(`object`: Any): Int {
        return POSITION_NONE
    }


}